<? require_once('Local_Settings.php');
require_once('cart/inc/functions/Cart_Functions.php');?>
<!--Alhier het systeem voor het behoud van een layout op de hele website. Alle wijzigingen aan de layout dienen te gebeuren in de header,body en footer.php bestanden. Enkel de content mag in dit bestand staan.-->
<?php include('style/header-1.php');//hieronder komt de linkerbalk met artikelen ?> 
<?php include('menu.php');//dit zorgt ervoor dat het menu verschijnt. ?>
<?php include('style/body-2.php');//hieronder het midden van de pagina ?>

<?php
include('config.php');
$tbl_name = "artikelen";
$FileName = pathinfo($_SERVER['PHP_SELF'], PATHINFO_FILENAME); //dit geeft de naam van de pagina terug, zonder .php erachter.


$max = 25; //amount of articles per page. change to what to want

$p = $_GET['p'];

if(empty($p))

{

$p = 1;

}

$limits = ($p - 1) * $max; 

$table = 'artikelen';
//view all the news articles in rows

$sql = mysql_query("select name, price, name2, name3, value, description, imagefilename, idartikelen FROM $tbl_name GROUP BY idartikelen LIMIT ".$limits.",$max") or die(mysql_error()); //nutteloze dingen er nog uit halen!!!

//the total rows in the table

$totalres = mysql_result(mysql_query("SELECT COUNT( DISTINCT idartikelen) AS tot FROM $tbl_name"),0);	

//the total number of pages (calculated result), math stuff...

$totalpages = ceil($totalres / $max); 

//the table

echo "<table border='3' width='550px;'><tr><td>artikelnummer</td><td>naam</td><td>prijs</td><td>thumb</td><td>korting<td></tr>";

while($r = mysql_fetch_array($sql))

{

$id = $r['idartikelen'];

$name = $r['name'];

$price= $r['price'];
$price =  number_format($price, 2, ',', ' ');
$img = $r['imagefilename'];

echo "<tr><td>$id</td><td>$name</td><td>&euro; $price</td><td><img src='images/products/thumb_$img'</img></td><td><a href='aanbiedingtoevoegen.php?id=$id'korting>korting toevoegen/product aanpassen</a></td></tr>";
}

//close up the table

echo "</table>";

if($totalpages >25)$totalpages=25;
for($i = 1; $i <= $totalpages; $i++){ 
//this is the pagination link
	
echo "<a href='$FileName.php?p=$i'>$i</a>|";

}
?>

<?php include('style/body-3.php');//hieronder de rechterbalk ?>
<? echo ( DisplayCartBald($Session_Prefix,$Currency_Symbol,$Currency_Code));?> 
<?php include('style/footer-4.php');?>
